﻿@model IList<Topic>

@if (Model.Count > 0)
{
	<ul class="itemsHeader">
		<li class="name">@T("Title")</li>
		<li class="replies">@T("Replies")</li>
		<li class="views">@T("Views")</li>
		<li class="lastPost">@T("Last post")</li>
	</ul>
   Forum tempf = (Forum)ViewData["currentForum"];
	<ul class="items">
		@foreach (Topic topic in Model)
  {
		<li class="@((topic.ReadAccessRole >= UserRole.Moderator ? "moderatorOnly" : ""))"
        onmouseover="DisplayEditButton(this)" onmouseout="HideEditButton(this)">
            <div style="margin:8px 5px">
                <em>
                    <img @(topic.IsSticky ? "src="+Url.Content("~/images/temp/icon-sticky.gif") : "") />
                </em>
                <em class="@(topic.IsSticky?"left-a":"left-b")">
                    @Html.ActionLink("[" + topic.TypeName + "]", "Detail", "Forums", new { forum = tempf.ShortName, page = 0, typeID = topic.TypeID }, null)
                </em>
                <div class="@(topic.IsSticky?"sticky-t":"")">
                    @Html.ActionLink(topic.Title, "Detail", "Topics", new { name = topic.ShortName, id = topic.Id, page = 0 },
                    new { @class = topic.IsSticky ? "sticky-t" : "itemTitle" })
                </div>
                <p>
                    <div class="left" style="padding-left:30px">
                        <span class="user">@Html.ActionLink(topic.User.UserName, "Detail", "Users", new { id = topic.User.Id }, null) </span>
				        <span class="date">@Html.Date(topic.Date, "yyyy-MM-dd HH:mm:ss")</span>
                    </div>

                    <div class="right">
                    <div class="right">
                        <span class="replies">@(topic.Replies != 1 ? T("{0} <span class=\"label\">replies</span>", topic.Replies) : T("1 <span class=\"label\">reply</span>"))</span>
			            <span class="separator">/ </span>
			            <span class="views">@(topic.Views != 1 ? T("{0} <span class=\"label\">views</span>", topic.Views) : T("1 <span class=\"label\">view</span>"))</span>
                    </div>
                    <div style="display:none" class="right">
				    @if (topic.LastMessage != null)
        {
					    <span class="label">@T("Last post")</span>
					    <span class="date">
						    <a href="@(Url.Action("Detail", "Topics", new { name = topic.ShortName, id = topic.Id, page = 0 }))#msg@(topic.LastMessage.Id)">
                           @Html.Partial("SinceDate", topic.LastMessage.Date)前
						    </a>
					    </span>
        }
        else
        {
					    <span class="nomsg">@T("No posts")</span>
        }
        <span>&nbsp;&nbsp;</span>
                </div>
                </div>
                </p>
                
            </div>
		</li>
  }
	</ul>
    
}